/*
 * Copyright 2020-2021 redragon.dongbin
 *
 * This file is part of redragon-erp/赤龙ERP.

 * redragon-erp/赤龙ERP is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.

 * redragon-erp/赤龙ERP is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with redragon-erp/赤龙ERP.  If not, see <https://www.gnu.org/licenses/>.
 */
package com.erp.prod.wip.dao.model;

import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
@Data
@Entity
@Table(name="prod_wip_task", schema="erp")
@DynamicInsert(true)
@DynamicUpdate(true)
public class ProdWipTask implements java.io.Serializable {

    //serialVersionUID
    private static final long serialVersionUID = 1L;

    //Constructors
    public ProdWipTask() {
    }
    
    //Fields
    
    //主键
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(name = "task_id", unique = true, nullable = false)
    private Integer taskId;

    //任务编码
    @NotBlank(message="任务编码不能为空")
    @Column(name = "task_code", unique = true, nullable = false, length = 45)
    private String taskCode;

    //任务名称
    @NotBlank(message="任务名称不能为空")
    @Column(name = "task_name", unique = true, nullable = false, length = 45)
    private String taskName;

    //任务类型（标准STANDARD、非标准NOSTANDARD）
    @NotBlank(message="任务类型不能为空")
    @Column(name = "task_type", unique = false, nullable = false, length = 10)
    private String taskType;

    //物料编码
    @NotBlank(message="物料编码不能为空")
    @Column(name = "material_code", unique = false, nullable = false, length = 45)
    private String materialCode;

    //物料单位
    @NotBlank(message="物料单位不能为空")
    @Column(name = "material_unit", unique = false, nullable = false, length = 45)
    private String materialUnit;

    //生产数量
    @NotNull(message="生产数量不能为空")
    @Column(name = "quantity", unique = false, nullable = false)
    private BigDecimal quantity;

    //开工日期
    @NotNull(message="开工日期不能为空")
    @Column(name = "start_date", unique = false, nullable = true)
    private Date startDate;

    //完工日期
    @Column(name = "end_date", unique = false, nullable = true)
    private Date endDate;

    //物料清单编码
    @Column(name = "bom_head_code", unique = false, nullable = true, length = 45)
    private String bomHeadCode;

    //工艺路线编码
    @Column(name = "craft_code", unique = false, nullable = true, length = 45)
    private String craftCode;

    //版本
    @Column(name = "version", unique = false, nullable = false)
    private Integer version;

    //任务状态（未发放NOASSIGN、已发放ASSIGN、完成FINISH，取消CANCEL）
    @NotBlank(message="任务状态不能为空")
    @Column(name = "task_status", unique = false, nullable = false, length = 45)
    private String taskStatus;

    //状态（新建NEW，确认CONFIRM，变更ALTER，取消CANCEL）
    @Column(name = "status", unique = false, nullable = false, length = 45)
    private String status;

    //审批状态（未提交UNSUBMIT、已提交SUBMIT、已审批APPROVE、已驳回REJECT）
    @Column(name = "approve_status", unique = false, nullable = false, length = 45)
    private String approveStatus;

    //制单人
    @Column(name = "staff_code", unique = false, nullable = false, length = 45)
    private String staffCode;

    //制单部门
    @Column(name = "department_code", unique = false, nullable = false, length = 45)
    private String departmentCode;

    //创建时间
    @Column(name = "created_date", unique = false, nullable = false)
    private Date createdDate;

    //创建人
    @Column(name = "created_by", unique = false, nullable = false, length = 45)
    private String createdBy;

    //最后修改时间
    @Column(name = "last_updated_date", unique = false, nullable = true)
    private Date lastUpdatedDate;

    //最后修改人
    @Column(name = "last_updated_by", unique = false, nullable = true, length = 45)
    private String lastUpdatedBy;

    //组织机构
    @Column(name = "org_code", unique = false, nullable = false, length = 10)
    private String orgCode;

    //显示字段
    @Transient
    private String materialStandard;
    @Transient
    private String staffName;
    @Transient
    private String departmentName;
    @Transient
    private String bomHeadName;
    @Transient
    private String craftName;
    @Transient
    private String bomVersion;
    @Transient
    private String craftVersion;


}